export const setWatch = (tableData) => {
  let obj = {}
  tableData.forEach(item => {
    obj[item.key || item] = {
      handler(val) {
        setTaskBookData(item.key || item, val)
        item.funs && item.funs(val)
      },
      deep: true
    }
  })
  return obj
}
export const setTaskBookData = (key, val) => {
  let taskBookData = sessionStorage.getItem('taskBookData')
  if (taskBookData && taskBookData !== 'null') {
    taskBookData = JSON.parse(taskBookData)
  } else {
    taskBookData = window.vueInstance.$store.state.taskBookData.taskBookData
  }
  taskBookData[key] = val
  window.vueInstance.$store.commit('setTaskBookData', taskBookData)
  // console.log(taskBookData)
}